@model EmailAccountSearchModel

@{
    //page title
    ViewBag.PageTitle = T("Admin.Configuration.EmailAccounts").Text;
    //active menu item (system name)
    Html.SetActiveMenuItemSystemName("Email accounts");
}

<div class="content-header clearfix">
    <h1 class="pull-left">
        @T("Admin.Configuration.EmailAccounts")
    </h1>
    <div class="pull-right">
        <a asp-action="Create" class="btn bg-blue">
            <i class="fa fa-plus-square"></i>
            @T("Admin.Common.AddNew")
        </a>
        @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.EmailAccountListButtons })
    </div>
</div>

<div class="content">
    <div class="form-horizontal">
        <div class="panel-group">
            <div class="panel panel-default">
                <div class="panel-body">
                    @await Html.PartialAsync("Table", new DataTablesModel
                    {
                        Name = "email-accounts-grid",
                        UrlRead = new DataUrl("List", "EmailAccount", null),
                        Length = Model.PageSize,
                        LengthMenu = Model.AvailablePageSizes,
                        ColumnCollection = new List<ColumnProperty>
                        {
                            new ColumnProperty(nameof(EmailAccountModel.Email))
                            {
                                Title = T("Admin.Configuration.EmailAccounts.Fields.Email").Text
                            },
                            new ColumnProperty(nameof(EmailAccountModel.DisplayName))
                            {
                                Title = T("Admin.Configuration.EmailAccounts.Fields.DisplayName").Text,
                                Width = "200"
                            },
                            new ColumnProperty(nameof(EmailAccountModel.IsDefaultEmailAccount))
                            {
                                Title = T("Admin.Configuration.EmailAccounts.Fields.IsDefaultEmailAccount").Text,
                                Width = "200",
                                ClassName =  NopColumnClassDefaults.CenterAll,
                                Render = new RenderBoolean()
                            },
                            new ColumnProperty(nameof(EmailAccountModel.Id))
                            {
                                Title = T("Admin.Configuration.EmailAccounts.Fields.MarkAsDefaultEmail").Text,
                                Width = "200",
                                ClassName =  NopColumnClassDefaults.CenterAll,
                                Render = new RenderButtonCustom(NopButtonClassDefaults.Success, T("Admin.Configuration.EmailAccounts.Fields.MarkAsDefaultEmail").Text)
                                {
                                    Url = Url.Content("~/Admin/EmailAccount/MarkAsDefaultEmail/")
                                }

                            },
                            new ColumnProperty(nameof(EmailAccountModel.Id))
                            {
                                Title = T("Admin.Common.Edit").Text,
                                Width = "100",
                                ClassName =  NopColumnClassDefaults.Button,
                                Render = new RenderButtonEdit(new DataUrl("Edit"))
                            }
                        }
                    })
                </div>
            </div>
        </div>
    </div>
</div>